﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace QYmall.Core.Model.ViewModels
{
    /// <summary>
    /// 促销活动(显示)
    /// </summary>
    public class ShopPromotionDto : ShopPromotionEditDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [StringLength(128)]
        public string? AddBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新人
        /// </summary>
        [Display(Name = "更新人")]
        [StringLength(128)]
        public string? UpdateBy { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Display(Name = "更新时间")]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 已删除：0否1是
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte IsDelete { get; set; } = 0;

        /// <summary>
        /// 店铺名称
        /// </summary>
        [Display(Name = "店铺名称")]
        public string? MerchantTitle { get; set; }


        /// <summary>
        /// 优惠券
        /// </summary>
        public ShopCouponDto? ShopCoupon { get; set; }

        /// <summary>
        /// 商品货品
        /// </summary>
        public ShopGoodsProductListDto? GoodsProduct { get; set; }
    }

    /// <summary>
    /// 促销活动(编辑)
    /// </summary>
    public class ShopPromotionEditDto
    {
        /// <summary>
        /// 所属商户ID
        /// </summary>
        [Display(Name = "所属商户")]
        public int MerchantId { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        [Display(Name = "开始时间")]
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        [Display(Name = "结束时间")]
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 生效条件
        /// </summary>
        [Display(Name = "消费额度")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal Condition { get; set; }

        /// <summary>
        /// 奖励类型
        /// 1减金额
        /// 2奖励折扣
        /// 3赠送积分
        /// 4赠送优惠券
        /// 5赠送赠品
        /// 6免运费
        /// </summary>
        [Display(Name = "奖励类型")]
        public byte AwardType { get; set; }

        /// <summary>
        /// 奖励值
        /// </summary>
        [Display(Name = "奖励值")]
        public long AwardValue { get; set; }

        /// <summary>
        /// 活动标题
        /// </summary>
        [Display(Name = "活动标题")]
        [Required(ErrorMessage = "{0}不可为空")]
        [StringLength(128)]
        public string? Title { get; set; }

        /// <summary>
        /// 活动简介
        /// </summary>
        [Display(Name = "活动简介")]
        [StringLength(512)]
        public string? Remark { get; set; }

        /// <summary>
        /// 状态0开启1关闭
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte Status { get; set; } = 0;

        /// <summary>
        /// 排序数字
        /// </summary>
        [Display(Name = "排序数字")]
        public int SortId { get; set; } = 99;
    }
}
